#!/bin/sh
module="rabbit"
device="rabbit"
mode="666"

echo "delete the module"
rmmod $module
echo "insert the module"
insmod ./$module.ko

rm -f /dev/${device}[0-7]

major=$(cat /proc/devices | grep $device | head -1 | awk '{print $1}')
echo MAJOR=$major

mknod /dev/${device}0 c $major 0
mknod /dev/${device}1 c $major 1
mknod /dev/${device}2 c $major 2
mknod /dev/${device}3 c $major 3
mknod /dev/${device}4 c $major 4
mknod /dev/${device}5 c $major 5
mknod /dev/${device}6 c $major 6
mknod /dev/${device}7 c $major 7

chmod $mode /dev/${device}[0-7]

echo "write data"
echo 12345678909 > /dev/${device}0
